import type { MultipleConditionSearchSchema } from '@/components/multiple-condition-search'

export default function useConfig() {
  const searchSchema = computed<MultipleConditionSearchSchema>(() => {
    return {
      placeholder: '默认按照证书域名搜索',
      widgets: [
        {
          type: 'input',
          label: '证书域名',
          field: 'name_keyword',
          maxLength: 30,
        },
        {
          type: 'input',
          label: '证书品牌',
          field: 'domain_keyword',
        },
        {
          type: 'input',
          label: '证书来源',
          field: 'domain_keyword',
        },
        {
          label: '过期时间',
          dataIndex: 'created_at',
          sortable: sortableSettings,
          format: 'date-time',
        },
      ],
    }
  })

  const tableColumns = buildColumns([
    {
      title: '更新时间',
      dataIndex: 'updated_at',
      format: 'date-time',
    },
    {
      title: '触发方式',
      dataIndex: 'trigger_source',
      slotName: 'trigger_source',
    },

    {
      title: '更新状态',
      dataIndex: 'status',
      slotName: 'status',
    },
    {
      title: '操作',
      fixed: 'right',
      slotName: 'actions',
      width: 56,
      cellClass: 'actions-cell',
    },
  ])

  return {
    searchSchema,
    tableColumns,
  }
}
